# -*- coding: utf-8 -*-
# @Time    : 2021/1/11 11:23
# @Author  : yuanxi

from basic.device.Android import Android
from airtest.core.api import *

class authorizePage(Android):

    # 服务协议页面标题
    authorizeTitle = "com.cloudbae.lovenanning:id/tvHybridapiWebViewTitle"
    # 确认按钮
    confirmBtn = "btn1"

    @classmethod
    def ifAuthorize(self):
        try:
            authPage = self.poco(self.authorizeTitle)
            if authPage.wait(3).exists():
                self.poco(self.confirmBtn).click()
                sleep(3)
                print("已点击确认")
        except Exception:
            print("已授权")


